using AssemblyVerifier;
using DynamicProxies;
using DynamicProxies.Tests.InterfaceImplementation;
using DynamicProxies.Tests.Types;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Reflection;
using System.Reflection.Emit;

namespace DynamicProxies.Tests
{
	[TestClass]
	public sealed class CancelCallTests : BaseTests
	{
		protected override sealed void OnSetup()
		{
			this.Counts.Add("Hook", new CallCount());
		}

		[TestMethod]
		public void CreateAndCancelCall()
		{
			Proxy.Create<SimpleClass>(this).Hook();
			Assert.AreEqual(0, this.Counts["Hook"].AfterCount);
		}

		protected override sealed bool OnBeforeMethodInvocation(MethodBase target, object[] arguments)
		{
			return false;
		}
	}
}
